package com.hxy.manager.activity.bill;


import com.hxy.manager.R;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;


/**
 * Created by 傲寒宏志 on 2018/2/4.
 */

public class Bill extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bill);
        setTitle("新店账单");
        
        CreateSqlBill();

        getActionBar().setDisplayHomeAsUpEnabled(true);//向上返回
        
      
    }
    public void nianhuodan(View v){
    	//Toast.makeText(getApplicationContext(), "年货单！", Toast.LENGTH_SHORT).show();
    	startActivity(new Intent(Bill.this,BillNianhuo.class));
    }

    void  CreateSqlBill(){
    	
        SQLiteDatabase db = openOrCreateDatabase("My_DB.db",MODE_PRIVATE,null);
        db.execSQL("create table if not exists BillInCompany(id integer primary key, name text,price text,date text,photo text,time text)");
        db.execSQL("create table if not exists BillInBill(id integer primary key autoincrement, name text,price text,date text,photo text,time text)");
       //年货单的表
        db.execSQL("create table if not exists BillNianhuo(id integer primary key autoincrement, name text,phone text,address text,date text,photo text,photo1 text,photo2 text,photo3 text,time text)");
        
    	
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu){
      //  getMenuInflater().inflate(R.menu.main,menu);
        return super.onCreateOptionsMenu(menu);
    }
    


    public boolean onOptionsItemSelected(MenuItem item){

        switch(item.getItemId()){
        case android.R.id.home:  //默认添加的
		      finish();  
		      break;  }
        return false;
    }
}
